package com.atguigu.tingshu.order.pattern.impl;

import com.atguigu.tingshu.common.constant.SystemConstant;
import com.atguigu.tingshu.common.rabbit.constant.MqConst;
import com.atguigu.tingshu.common.rabbit.service.RabbitService;
import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.order.pattern.PayStrategy;
import com.atguigu.tingshu.vo.order.OrderInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * ClassName : VXPay
 * Package : com.atguigu.tingshu.order.pattern.impl
 * Description :
 * <p>
 * Author: LHZ
 * Create: 2025/8/4 15:35
 * Version: 1.0
 */
@Slf4j
@SuppressWarnings("all")
@RefreshScope
@Component(SystemConstant.ORDER_PAY_WAY_WEIXIN)
public class VXPay implements PayStrategy {
    @Autowired
    private RabbitService rabbitService;
    @Value("${order.cancel}")
    private int ttl;

    @Override
    public void submitOrder(Long userId, OrderInfo orderInfo) {

        // 延迟关单
        rabbitService.sendDealyMessage(MqConst.EXCHANGE_CANCEL_ORDER,
                MqConst.ROUTING_CANCEL_ORDER,orderInfo.getId(),ttl); //延时300s

    }
}